/* @(#)GSOrderDeptInfoScanQueryAction.java    V0.1
 *
 * Project: GSdevelop
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   owen         2006-2-16
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2006 Beijing HiTRUST Technology Co., Ltd. 1808 Room, 
 *        Science & Technology Building, No. 9 South Street, Zhong Guan Cun, 
 *        Haidian District, Beijing ,100081, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Beijing HiTRUST Technology Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with HiTRUST.
 *
 * Warning:
 * =============================================================================
 * 
 */
package com.hitrust.gs.action;

import java.util.ArrayList;

import com.hitrust.gs.bean.GSOrderDeptInfoBean;
import com.hitrust.gs.business.GSOrderDeptInfoProcessor;
import com.hitrust.gs.business.GSOrganizationProcessor;
import com.hitrust.gs.form.GSOrderDeptInfoScanQueryForm;
import com.hitrust.gs.lib.GSBaseConstants;
import com.hitrust.gs.service.GSBaseAction;
import com.hitrust.gs.service.GSBaseForm;
import com.hitrust.gs.service.GSBaseManager;
import com.hitrust.gs.util.page.ResultProcess;

/**
 * 
 */
public class GSOrderDeptInfoScanQueryAction extends GSBaseAction{

    public String execute(GSBaseForm aForm) throws Exception {
        GSOrderDeptInfoScanQueryForm tForm = (GSOrderDeptInfoScanQueryForm)aForm;
        String tOrgId=tForm.getOrg_id()==null?"":tForm.getOrg_id().trim();
        String tAddr=tForm.getGsdelivergoodsaddr()==null?"":tForm.getGsdelivergoodsaddr().trim();
        ArrayList tOrderDeptInfo=GSOrderDeptInfoProcessor.queryOrderDeptInfo(tOrgId,tAddr);
        ResultProcess tRsProc = new ResultProcess();
        ArrayList tList = new ArrayList();
        GSOrderDeptInfoBean tGSOrderDeptInfoBean=new GSOrderDeptInfoBean();
        if (tOrderDeptInfo != null && tOrderDeptInfo.size() > 0) {
            for (int i = 0; i < tOrderDeptInfo.size(); i++) {
                tGSOrderDeptInfoBean = (GSOrderDeptInfoBean) tOrderDeptInfo.get(i);
                
                String[] tStr = new String[6];
                tStr[0]=tGSOrderDeptInfoBean.getGs_org_id();
                tStr[1]=tGSOrderDeptInfoBean.getGs_deliver_goods_addr();
                tStr[2]=tGSOrderDeptInfoBean.getGs_order_contact_name();
                tStr[3]=tGSOrderDeptInfoBean.getGs_order_contact_phone();
                tStr[4]=tGSOrderDeptInfoBean.getGs_deliver_goods_addr_id();
                tStr[5]=GSBaseManager.getOrgNameByOrgId(tGSOrderDeptInfoBean.getGs_org_id());
                 
                tList.add(tStr);
            }
            tRsProc.setResult(tList);
            }
        tForm.getRequest().setAttribute("OrderDeptInfoList", tRsProc);
        //tForm.getRequest().setAttribute("choice",tForm.getRequest().getParameter("choice"));
        ArrayList tAllOraganization = GSOrganizationProcessor.queryManageOrg("","");
        aForm.getRequest().setAttribute("AllOraganization",tAllOraganization);
        aForm.getRequest().setAttribute("requery","false");
        return GSBaseConstants.FORWARD_SUCCESS;
    }

}
